package com.soundShape.mediators.administration
{
	
	import com.soundShape.events.SoundShapeEvent;
	import com.soundShape.mediators.AbstractViewMediator;
	import com.soundShape.popUps.EditEmployee;
	import com.soundShape.views.administration.Administration;
	import com.soundShape.vo.EmployeeVO;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import mx.collections.ArrayCollection;
	import mx.events.ListEvent;
	import mx.managers.PopUpManager;
	
	import nz.co.codec.flexorm.criteria.Criteria;
	
	
	
	
	public class AdministrationMediator extends AbstractViewMediator
	{
		
	
		
				
				public function AdministrationMediator()
				{
					super(Administration);
				}
				
				/**
				 * Since the AbstractViewMediator sets the view via Autowiring in Swiz,
				 * we need to create a local getter to access the underlying, expected view
				 * class type.
				 */
				public function get view():Administration
				{
					return this._view as Administration;
				}
				
				/**
				 * The <code>init()</code> method is fired off automatically by the 
				 * AbstractViewMediator when the creation complete event fires for the
				 * corresponding ViewMediator's view. This allows us to listen for events
				 * and set data bindings on the view with the confidence that our view
				 * and all of it's child views have been created and live on the stage.
				 */
				override protected function init():void
				{
					super.init();
					
					this.setViews();
					
				}
				
				override protected function setViewDataBindings():void
				{
					super.setViewDataBindings();
					
					
				}	
				
				override protected function setViewListeners():void
				{
					super.setViewListeners();
					
					//this.view.btnMenu.addEventListener(MouseEvent.CLICK, handleBtnMenu);
					
					this.view.btnAdminCustomer.addEventListener(MouseEvent.CLICK, handleBtnAdminCustomer);
					
					this.view.btnAdminEmployee.addEventListener(MouseEvent.CLICK, handleBtnAdminEmployee);
					
					this.view.btnSpecialDates.addEventListener(MouseEvent.CLICK, handleBtnSpecialDates);
					
					this.view.btnReferrals.addEventListener(MouseEvent.CLICK, handleBtnReferrals);
				}
				
				
				
				private function setViews():void
				{
					
				}
				
				
				/**
				 * *******************************************************************************
				 * Handlers
				 * *******************************************************************************
				 */
				private function handleBtnMenu(mouseEvent:MouseEvent):void
				{
					this.dispatcher.dispatchEvent(new SoundShapeEvent(SoundShapeEvent.SWITCH_TO_MENU_VIEW));
				}
				
				private function handleBtnAdminCustomer(mouseEvent:MouseEvent):void
				{
					this.dispatcher.dispatchEvent(new SoundShapeEvent(SoundShapeEvent.SWITCH_TO_ADMIN_CUSTOMER_VIEW));
				}
				
				private function handleBtnAdminEmployee(mouseEvent:MouseEvent):void
				{
					this.dispatcher.dispatchEvent(new SoundShapeEvent(SoundShapeEvent.SWITCH_TO_ADMIN_EMPLOYEE_VIEW));
				}
				
				protected function handleBtnReferrals(event:MouseEvent):void
				{
					this.dispatcher.dispatchEvent( new SoundShapeEvent(SoundShapeEvent.SWITCH_TO_REFERRALS_VIEW));
				}
				
				protected function handleBtnSpecialDates(event:MouseEvent):void
				{
					this.dispatcher.dispatchEvent( new SoundShapeEvent(SoundShapeEvent.SWITCH_TO_SPECIAL_DATES_VIEW));
				}
				
				
				
				private function callback():void
				{
					this.setViews();
				}
				
				
				/**
				 * *******************************************************************************
				 * Swiz EventHanders
				 * *******************************************************************************
				 */
				
				
				
				
				
				
			
		}
		
	}
